<template>
    <div>
        <el-table
            :data="orderDetail"
            border
            style="width: 100%">
            <el-table-column
            fixed
            prop="id"
            label="序号"
            width="150">
            </el-table-column>
            <el-table-column
            prop="name"
            label="合作商名称"
            width="auto">
            </el-table-column>
            <el-table-column
            prop="quantity"
            label="商品数量"
            width="auto" v-if="shopType=='1'">
            </el-table-column>
            <el-table-column
            prop="proportion"
            label="平台抽成比率"
            width="auto" v-if="shopType!='1'">
            </el-table-column>
            <el-table-column
            prop="order_price"
            label="订单价格"
            width="auto">
            </el-table-column>
            <el-table-column
            prop="store_income"
            label="结算金额"
            width="auto">
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
export default {
    props:{
        orderNo:{
            type:String,
            default:''
        },
        shopType:{
            type:String,
            default:''
        }
    },
    data(){
        return{
            orderDetail:[],
            page:1,
            pagesize:10,
            order_no:''
        }
    },
    watch:{
        orderNo(val){
            console.log(val,'订单号--');
            this.order_no = val
        },
        shopType(val){
            console.log(val);
            if(val=='1'){
                this.getShopOrderDetail()
            }else if(val=='2'){
                this.getDesginerOrderDetail()
            }else if(val=='3'){
                this.getBuildOrderDetail()
            }
        }
    },
    methods: {
        // 获取商家结算明细
        getShopOrderDetail(){
            let params = {
                order_no:this.orderNo,
                page:this.page,
                pagesize:this.pagesize
            }
            this.$http.post('/api/root/settle/shopOrderDetail',params).then(res=>{
                console.log(res,'商家结算明细');
                if(res.code==1){
                    this.orderDetail = res.data.list?res.data.list:[]
                }
            })
        },
        // 获取设计师结算明细
        getDesginerOrderDetail(){
            let params = {
                order_no:this.orderNo,
                page:this.page,
                pagesize:this.pagesize
            }
            this.$http.post('/api/root/settle/designerOrderDetail',params).then(res=>{
                console.log(res,'设计师结算明细');
                if(res.code==1){
                    this.orderDetail = res.data.list?res.data.list:[]
                }
            })
        },
        // 获取施工队结算明细
        getBuildOrderDetail(){
            let params = {
                order_no:this.orderNo,
                page:this.page,
                pagesize:this.pagesize
            }
            this.$http.post('/api/root/settle/buildOrderDetail',params).then(res=>{
                console.log(res,'施工队结算明细');
                if(res.code==1){
                    this.orderDetail = res.data.list?res.data.list:[]
                }
            })
        }
    },
}
</script>
<style lang="less">
@import 'shopTable.less';
</style>


